<div class="top">
  <h1><?php echo $heading_title; ?></h1>
</div>
<div class="middle">
  <?php if ($error_warning) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="create">
    <!--<p><?php echo $text_account_already; ?></p> -->
    <b style="margin-bottom: 3px; display: block;"><?php echo $text_your_details; ?></b>
    <div style="background: #F6F9FF; border: 1px solid #DDDDDD; padding: 10px; margin-bottom: 10px;">
      <table width="100%">
      	<tr>
          <td width="150"><?php echo $entry_username; ?></td>
          <td>
          	<input type="text" class="create_account" name="username" value="<?php echo $username; ?>" /> <span class="required">*</span>
            <?php if ($error_username) { ?>
            <span class="error"><?php echo $error_username; ?></span>
            <?php } ?>
          </td>
        </tr>
        <tr>
          <td><?php echo $entry_email; ?></td>
          <td><input class="create_account" type="text" name="email" value="<?php echo $email; ?>" /><span class="required">*</span>
            <?php if ($error_email) { ?>
            <span class="error"><?php echo $error_email; ?></span>
            <?php } ?>
           </td>
        </tr>
        <tr>
          <td><?php echo $entry_lastname; ?></td>
          <td><input class="create_account" type="text" name="lastname" value="<?php echo $lastname; ?>" />
            <?php if ($error_lastname) { ?>
            <span class="error"><?php echo $error_lastname; ?></span>
            <?php } ?></td>
        </tr>
		<tr>
          <td width="150"><?php echo $entry_firstname; ?></td>
          <td><input class="create_account" type="text" name="firstname" value="<?php echo $firstname; ?>" />
            <?php if ($error_firstname) { ?>
            <span class="error"><?php echo $error_firstname; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td><?php echo $entry_telephone; ?></td>
          <td><input class="create_account" type="text" name="telephone" value="<?php echo $telephone; ?>" />
            <?php if ($error_telephone) { ?>
            <span class="error"><?php echo $error_telephone; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td><?php echo $entry_ym; ?></td>
          <td><input class="create_account" type="text" name="ym" value="<?php echo $ym; ?>" />
            <?php if ($error_ym) { ?>
            <span class="error"><?php echo $error_ym; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td><?php echo $entry_skype; ?></td>
          <td><input class="create_account" type="text" name="skype" value="<?php echo $skype; ?>" />
            <?php if ($error_telephone) { ?>
            <span class="error"><?php echo $error_skype; ?></span>
            <?php } ?></td>
        </tr>
      </table>
    </div>
    <b style="margin-bottom: 3px; display: block;"><?php echo $text_your_password; ?></b>
    <div style="background:#F6F9FF;border: 1px solid #DDDDDD; padding: 10px; margin-bottom: 10px;">
      <table width="100%">
        <tr>
          <td width="150"><?php echo $entry_password; ?></td>
          <td><input class="create_account" type="password" name="password" value="<?php echo $password; ?>" /><span class="required">*</span>
            <?php if ($error_password) { ?>
            <span class="error"><?php echo $error_password; ?></span>
            <?php } ?>
          </td>
        </tr>
        <tr>
          <td><?php echo $entry_confirm; ?></td>
          <td><input class="create_account" type="password" name="confirm" value="<?php echo $confirm; ?>" /><span class="required">*</span>
            <?php if ($error_confirm) { ?>
            <span class="error"><?php echo $error_confirm; ?></span>
            <?php } ?>
           </td>
        </tr>
      </table>
    </div>
    <div>
    	<?php if($chk_more == 1) { ?>
	    	<input type="checkbox" checked="checked" onClick="hideChk();" value="1" name="chk_more" id="chk_more" ><?php echo $text_moreinfo; ?>
	    <?php } else { ?>
	    	<input type="checkbox" onClick="hideChk();" value="1" name="chk_more" id="chk_more" ><?php echo $text_moreinfo; ?>
	    <?php } ?>
    </div>
    <div id="more_info" style="background: #F6F9DD; border: 1px solid #DDDDDD; padding: 10px; margin-bottom: 10px;">
    <b style="margin-bottom: 3px; display: block;"><?php echo $text_your_address; ?></b>
      <table width="100%">        
        <tr>
          <td><?php echo $entry_fax; ?></td>
          <td><input class="create_account" type="text" name="fax" value="<?php echo $fax; ?>" /></td>
        </tr>

        <tr>
          <td width="150"><?php echo $entry_company; ?></td>
          <td><input class="create_account" type="text" name="company" value="<?php echo $company; ?>" /></td>
        </tr>
        <tr>
          <td><?php echo $entry_address_1; ?></td>
          <td><input class="create_account" type="text" name="address_1" value="<?php echo $address_1; ?>" />
            <?php if ($error_address_1) { ?>
            <span class="error"><?php echo $error_address_1; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td><?php echo $entry_address_2; ?></td>
          <td><input class="create_account" type="text" name="address_2" value="<?php echo $address_2; ?>" /></td>
        </tr>        
        <tr>
          <td><?php echo $entry_country; ?></td>
          <td><select style="width: 150px;" name="country_id" id="country_id" onchange="$('#zone').load('index.php?route=account/create/zone&country_id=' + this.value + '&zone_id=<?php echo $zone_id; ?>');">
              <?php foreach ($countries as $country) { ?>
		            <option value="<?php echo $country['country_id']; ?>"><?php echo $country['name']; ?></option>
             <?php } ?>
            </select></td>
        </tr>
        <tr>
          <td><?php echo $entry_zone; ?></td>
          <td id="zone">
          	<select style="width: 150px;" name="zone_id">
            </select>
          </td>
        </tr>
      </table>
    </div>
	<!--Start add code by D-Ngan July 2012-->
    <p>
    <b><?php echo $txtTileCaptcha; ?></b>
     <div style="background: #F6F9FF; border: 1px solid #DDDDDD; padding: 10px; margin-bottom: 10px;">
		<div style="float:left; font-size:14px">
        <b><?php echo $textCaptcha; ?></b>
        </div>
     	<input type="text" style="height:20px; float:left;" name="valid_captcha" />
     <?php	
     		
			$listDir=explode('/',str_replace('\\','/',DIR_SYSTEM));
			$lastDir=$listDir[count($listDir)-2];
			$relateDir='./'.$lastDir.str_replace('\\','/','\library');
			$fileCapPath=$relateDir.'/captcha.php';
			if(!file_exists($fileCapPath)){
				exit('Error: Unale to load captcha.php');
			}
			require_once($fileCapPath);
			$capthaOBJ = new Captcha();
			$imgout=$relateDir.'/outimg.jpg';
			$capthaOBJ->OutputCaptcha(100,30,6,$relateDir.'/img.jpg',$imgout);
        ?>
			<img style="margin-top:0px;" src="<?php echo $imgout; ?>"width="100" height="30" />
        <?php if ($error_captchaFlag) { ?>
            <span class="error"><?php echo $errorCaptcha; ?></span>
        <?php } ?>
     </div>
    <!--End add code by D-Ngan July 2012-->
    
    <b style="margin-bottom: 3px; display: block;"><?php echo $text_newsletter; ?></b>
    <div style="background: #F6F9FF; border: 1px solid #DDDDDD; padding: 10px; margin-bottom: 10px;">
      <table width="100%">
        <tr>
          <td width="150"><?php echo $entry_newsletter; ?></td>
          <td><?php if ($newsletter == 1) { ?>
            <input type="radio" name="newsletter" value="1" checked="checked" />
            <?php echo $text_yes; ?>
            <input type="radio" name="newsletter" value="0" />
            <?php echo $text_no; ?>
            <?php } else { ?>
            <input type="radio" name="newsletter" value="1" checked="checked" />
            <?php echo $text_yes; ?>
            <input type="radio" name="newsletter" value="0"  />
            <?php echo $text_no; ?>
            <?php } ?></td>
        </tr>
      </table>
    </div>
    
    <?php if ($text_agree) { ?>
    <div class="buttons">
      <table>
        <tr>
          <td align="right" style="padding-right: 5px;"><?php echo $text_agree; ?></td>
          <td width="5" style="padding-right: 10px;"><?php if ($agree) { ?>
            <input type="checkbox" name="agree" value="1" checked="checked" />
            <?php } else { ?>
            <input type="checkbox" name="agree" value="1" checked="checked" />
            <?php } ?></td>
          <td align="right" width="15%"><a onclick="$('#create').submit();" class="button"><span><?php echo $button_continue; ?></span></a></td>
        </tr>
      </table>
    </div>
    <?php } else { ?>
    <div class="buttons1">
      <table>
        <tr>
          <td align="right"><a onclick="$('#create').submit();" class="button"><span><?php echo $button_continue; ?></span></a></td>
        </tr>
      </table>
    </div>
    <?php } ?>
  </form>
</div>
<div class="bottom">&nbsp;</div>
<script type="text/javascript"><!--
$('#zone').load('index.php?route=account/create/zone&country_id=<?php echo $country_id; ?>&zone_id=<?php echo $zone_id; ?>');
$('#country_id').attr('value', '<?php echo $country_id; ?>');
function hideChk()
{
	if ($('input[name=chk_more]').is(':checked')) {
	   	$('#more_info').show();
	}
	else {
	   	$('#more_info').hide();
	}
}

if ($('input[name=chk_more]').is(':checked')) {
   	$('#more_info').show();
} else{
	$('#more_info').hide();
}
//--></script>
